package com.effectiv.gooruda.rest.api.controller;

import org.springframework.social.facebook.api.Facebook;
import org.springframework.social.facebook.api.Page;
import org.springframework.social.facebook.api.PagedList;
import org.springframework.social.facebook.api.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/api/facebook/like")
public class FacebookLikeOperations {

	@RequestMapping(value = "/getactivities", method = RequestMethod.GET)
	public PagedList<Page> getActivities(Facebook facebook) {
		return facebook.likeOperations().getActivities();
	}

	@RequestMapping(value = "/getactivities/{userId}", method = RequestMethod.GET)
	public PagedList<Page> getActivities(String userId, Facebook facebook) {
		return facebook.likeOperations().getActivities(userId);
	}

	@RequestMapping(value = "/getbooks", method = RequestMethod.GET)
	public PagedList<Page> getBooks(Facebook facebook) {
		return facebook.likeOperations().getBooks();
	}

	@RequestMapping(value = "/getbooks/{userId}", method = RequestMethod.GET)
	public PagedList<Page> getBooks(String userId, Facebook facebook) {
		return facebook.likeOperations().getBooks(userId);
	}

	@RequestMapping(value = "/getgames", method = RequestMethod.GET)
	public PagedList<Page> getGames(Facebook facebook) {
		return facebook.likeOperations().getGames();
	}

	@RequestMapping(value = "/getgames/{userId}", method = RequestMethod.GET)
	public PagedList<Page> getGames(String userId, Facebook facebook) {
		return facebook.likeOperations().getGames(userId);
	}

	@RequestMapping(value = "/getinterests", method = RequestMethod.GET)
	public PagedList<Page> getInterests(Facebook facebook) {
		return facebook.likeOperations().getInterests();
	}

	@RequestMapping(value = "/getinterests/{userId}", method = RequestMethod.GET)
	public PagedList<Page> getInterests(String userId, Facebook facebook) {
		return facebook.likeOperations().getInterests(userId);
	}

	@RequestMapping(value = "/getlikes/{objectId}", method = RequestMethod.GET)
	public PagedList<Reference> getLikes(String objectId, Facebook facebook) {
		return facebook.likeOperations().getLikes(objectId);
	}

	@RequestMapping(value = "/getmovies", method = RequestMethod.GET)
	public PagedList<Page> getMovies(Facebook facebook) {
		return facebook.likeOperations().getMovies();
	}

	@RequestMapping(value = "/getmovies/{userId}", method = RequestMethod.GET)
	public PagedList<Page> getMovies(String userId, Facebook facebook) {
		return facebook.likeOperations().getMovies(userId);
	}

	@RequestMapping(value = "/getmusic", method = RequestMethod.GET)
	public PagedList<Page> getMusic(Facebook facebook) {
		return facebook.likeOperations().getMusic();
	}

	@RequestMapping(value = "/getmusic/{userId}", method = RequestMethod.GET)
	public PagedList<Page> getMusic(String userId, Facebook facebook) {
		return facebook.likeOperations().getMusic(userId);
	}

	@RequestMapping(value = "/getpagesliked", method = RequestMethod.GET)
	public PagedList<Page> getPagesLiked(Facebook facebook) {
		return facebook.likeOperations().getPagesLiked();
	}

	@RequestMapping(value = "/getpagesliked/{userId}", method = RequestMethod.GET)
	public PagedList<Page> getPagesLiked(String userId, Facebook facebook) {
		return facebook.likeOperations().getPagesLiked(userId);
	}

	@RequestMapping(value = "/gettelevision", method = RequestMethod.GET)
	public PagedList<Page> getTelevision(Facebook facebook) {
		return facebook.likeOperations().getTelevision();
	}

	@RequestMapping(value = "/gettelevision/{userId}", method = RequestMethod.GET)
	public PagedList<Page> getTelevision(String userId, Facebook facebook) {
		return facebook.likeOperations().getTelevision(userId);
	}

	@RequestMapping(value = "/like/{objectId}", method = RequestMethod.POST)
	public void like(String objectId, Facebook facebook) {
		facebook.likeOperations().like(objectId);
	}

	@RequestMapping(value = "/unlike/{objectId}", method = RequestMethod.POST)
	public void unlike(String objectId, Facebook facebook) {
		facebook.likeOperations().unlike(objectId);
	}

}
